package com.taobao.schedule.checker;

import java.util.Arrays;
import java.util.List;

import com.taobao.schedule.monitor.AlertMsgManager;
import com.taobao.schedule.utils.TextUtil;

/**
 * 通用的校验器，抽取共用的逻辑
 * @author Livis
 *
 */
public abstract class GenericChecker implements Checker{
	
	private List<String> wwUsersList;
	private List<String> mobilesList;
	private long checkInterval;
	private AlertMsgManager alertMsgManager;
	
	protected void alertByWW(String msg){
		alertMsgManager.alertByWW(this.getUsers(), msg);
	}
	
	protected void alertByMobile(String msg) {
		alertMsgManager.alertByMobile(this.getMobiles(), msg);
	}
	
	public String getUsers() {
		return TextUtil.list2String(wwUsersList);
	}

	public void setUsers(String users) {
		this.wwUsersList = Arrays.asList(users.split(","));
	}

	public String getMobiles() {
		return TextUtil.list2String(mobilesList);
	}
	public void setMobiles(String mobiles) {
		this.mobilesList = Arrays.asList(mobiles.split(","));;
	}
	public long getCheckInterval() {
		return checkInterval;
	}
	public void setCheckInterval(long checkInterval) {
		this.checkInterval = checkInterval;
	}
	public void setAlertMsgManager(AlertMsgManager alertMsgManager) {
		this.alertMsgManager = alertMsgManager;
	}
	
}
